import * as React from "react";
import AdminLayout from "../../components/AdminLayout.tsx";
import Attendance from "../../components/Attendance.tsx";
import Settings from "../../components/Settings.tsx";
import Employees from "../../components/Employees.tsx";
import Admin from "./Admin.tsx";
import {Box} from "@mui/material";

const SuperAdminMainWindow: React.FC = () => {
    const [isDrawerOpen, setIsDrawerOpen] = React.useState(true);
    const [selectedModule, setSelectedModule] = React.useState('attendance'); // 默认显示考勤情况模块

    const handleDrawerToggle = () => {
        setIsDrawerOpen(!isDrawerOpen);
    };

    const handleModuleSelect = (moduleKey: string) => {
        setSelectedModule(moduleKey);
    };

    const modules = [
        {key: 'attendance', label: '查看考勤情况'},
        {key: 'settings', label: '设置考勤规则'},
        {key: 'employees', label: '管理员工信息'},
        {key: 'admin', label: '添加管理员页'},
    ];

    return (
        <Box sx={{backgroundColor: '#ffffff'}}>
            <AdminLayout
                title="韵匙——超级管理员管理后台"
                modules={modules}
                onModuleSelect={handleModuleSelect}
                isDrawerOpen={isDrawerOpen}
                onDrawerToggle={handleDrawerToggle}
                content={
                    <>
                        {selectedModule === 'attendance' && <Attendance/>}
                        {selectedModule === 'settings' && <Settings/>}
                        {selectedModule === 'employees' && <Employees/>}
                        {selectedModule === 'admin' && <Admin/>}
                    </>
                }
            />
        </Box>
    );
};

export default SuperAdminMainWindow;
